/**
 * 
 */

package com.pp.admin.main.client.tab;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
import com.pp.admin.common.client.PermissionCheck;

/**
 * @author pandurang
 */
public class AdminTab extends BaseTab implements SelectionHandler {
	
	protected RootTab		parentTab		= null;
	
	private DomainUserPage	domainUserPage	= null;
	
	private RolesPage		rolePage		= null;
	
	private PermissionsPage	permissionPage	= null;
	
	/**
	 * @param barHeight
	 * @param barUnit
	 */
	public AdminTab( RootTab parent, double barHeight, Unit barUnit ) {

		super( barHeight, barUnit );
		parentTab = parent;
		if ( parentTab.checkPermission( PermissionCheck.DOMAIN_USER_PAGE ) ) {
			domainUserPage = new DomainUserPage( this );
			this.add( domainUserPage, new HTML( "[" + myConstants.domainuser() + "]" ) );
		}
		if ( parentTab.checkPermission( PermissionCheck.ROLE_PAGE ) ) {
			rolePage = new RolesPage( this );
			this.add( rolePage, new HTML( "[" + myConstants.roles() + "]" ) );
		}
		if ( parentTab.checkPermission( PermissionCheck.PERMISSION_PAGE ) ) {
			permissionPage = new PermissionsPage( this );
			this.add( permissionPage, new HTML( "[" + myConstants.permissions() + "]" ) );
		}
		
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.pp.admin.client.tab.SelectionHandler#refresh()
	 */
	@Override
	public void refresh() {

		domainUserPage.refresh();
	}
	
}
